UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'my6Gb6Zy+G1SMfy4nqy2/l7yCg6Qd1Qlp4mFpTBnMKE=' 
WHERE 
  key_id = '1ca328fd4c772903b705229d263e92f3ec42c3f6a3b4173cd3285df7de593a12' 
  AND (
    token = 'my6Gb6Zy+G1SMfy4nqy2/l7yCg6Qd1Qlp4mFpTBnMKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036