UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ulbwPaE2WU8BoXJvMMsEbNkN5D88/o8SS9H/l6R8XCw='
WHERE
key_id = 'ae391d08d74d1ec4081d644fc5c21820d409f863af752a54be03ac0a7e8b5cda'
AND (
token = 'ulbwPaE2WU8BoXJvMMsEbNkN5D88/o8SS9H/l6R8XCw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)