UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9kQMLPb57B5/NFu+zxKukzLwxdnj29F46DqSlpexA70=' 
WHERE 
  key_id = '1635be77d895eaedbefa3622d73009509374320c04693aa3e3647a2ac0ff3baa' 
  AND (
    token = '9kQMLPb57B5/NFu+zxKukzLwxdnj29F46DqSlpexA70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034