UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6+Y4xdT+UB0JXNAm5iW0zJYjyttyc4Mq3617QYgw5Ms='
WHERE
key_id = '2358fdeeb9566c33df4fc6a534816e7e1587574a7dd255722c0c03feb1214dee'
AND (
token = '6+Y4xdT+UB0JXNAm5iW0zJYjyttyc4Mq3617QYgw5Ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)