UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oQfbf0NRQJpRfdpMxXR2Ye4Jv3hqLgdP47p41s3xbX4='
WHERE
key_id = '2eaa8d786b99d3f0e55f9a02d3e304cf4b90312fe255412423b38c20ddcf2bbc'
AND (
token = 'oQfbf0NRQJpRfdpMxXR2Ye4Jv3hqLgdP47p41s3xbX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)