UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iy0Af4LcuTTin7jUrzuj44nvY0/oWs2jEKO8gD5tYWs=' 
WHERE 
  key_id = '0dd647d8607d07f7e068e8c62875d9bb70d6ffcbfa5e89435179f5ce4bb90476' 
  AND (
    token = 'Iy0Af4LcuTTin7jUrzuj44nvY0/oWs2jEKO8gD5tYWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036