UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1+T8qpkgMw8AW062x2UMhHWpOK2xo/qi0Vr3vtEEzm8=' 
WHERE 
  key_id = '8eb05cee2dc1fa009442ebd624757d55d054afc552ab19c6c79ef253171a357e' 
  AND (
    token = '1+T8qpkgMw8AW062x2UMhHWpOK2xo/qi0Vr3vtEEzm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038