UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cftKZn5Lz0mfM8Nhg+rWFS4E8o77YLQ9hss9ottLCxQ=' 
WHERE 
  key_id = '72f2815b71764ac5955c23e858d91a2121874e5391104425e70689cd641f29ae' 
  AND (
    token = 'cftKZn5Lz0mfM8Nhg+rWFS4E8o77YLQ9hss9ottLCxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033