UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e5cS+8tVSqfBa+3XCbWMDLZFX+pxMIXdLoQhq5GesL8='
WHERE
key_id = '6d5cbe0ac9797e9f977213940f414549cde25fe82c02ea227e57304b64dbea7b'
AND (
token = 'e5cS+8tVSqfBa+3XCbWMDLZFX+pxMIXdLoQhq5GesL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)