UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qfBWYCbRbRvFonJDYxTcMXgtZXyaBabMBXD0ieVaj9I='
WHERE
key_id = '77423cd88b13b6e69fffa03c1932b7729a4c52d81b094b61f92a0fab4c76a22e'
AND (
token = 'qfBWYCbRbRvFonJDYxTcMXgtZXyaBabMBXD0ieVaj9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)