UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mel7Nr3Ke9JaAYWxJHAlqyf/ypHoMU4BzUAjL9Q3xeY=' 
WHERE 
  key_id = 'f942259f69089b5acd505805d0917402e3672ca5e972b300f641723c31a22b24' 
  AND (
    token = 'mel7Nr3Ke9JaAYWxJHAlqyf/ypHoMU4BzUAjL9Q3xeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043