UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'stROB8Crz12MGFitu5G9YIJ0JDJ3/lp8EAvzTAPEn0w=' 
WHERE 
  key_id = '3642b33b8b1990a3d6bec7b0a0abe54e64be86f3ec2adb367b74d1ddcaeef4c6' 
  AND (
    token = 'stROB8Crz12MGFitu5G9YIJ0JDJ3/lp8EAvzTAPEn0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029