UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IVAhUNEn231hDD1uZFR1yYZIoEw0mMschofwKnxoJqE=' 
WHERE 
  key_id = '51193e804a648f8cb48a080f04dccffda895aeb8286137e2f9d2f46362f88801' 
  AND (
    token = 'IVAhUNEn231hDD1uZFR1yYZIoEw0mMschofwKnxoJqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046