UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9o3HJE5YRp4Ld6RvW2dt6VikmZKxPtbKXAwxdyyhsx0=' 
WHERE 
  key_id = '4a1daab503a4505d31318fbe72615aeaf17489716a99cbf26ab97d539ab9b8cb' 
  AND (
    token = '9o3HJE5YRp4Ld6RvW2dt6VikmZKxPtbKXAwxdyyhsx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037