UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ARMKzKoOr+/5tlpM5/Z9xs8TnBGJKCDbmOkhu1O91l8=' 
WHERE 
  key_id = '457a1b438b573a38ecbea8d80a22a94152760d4df147fb80c752d61643611f08' 
  AND (
    token = 'ARMKzKoOr+/5tlpM5/Z9xs8TnBGJKCDbmOkhu1O91l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023