UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oBClFwF4TkFsMWHSHi/jxlBfZnbsGEOgBFeKYJiy/iw=' 
WHERE 
  key_id = '565fb27118546d346be39f2abc454bf3d4a24065365edaf8f4011a5df60891d0' 
  AND (
    token = 'oBClFwF4TkFsMWHSHi/jxlBfZnbsGEOgBFeKYJiy/iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026