UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agY5wppnh4O3GsRtpZ/j7yi/vGHcy+3nYfNtzE0m+j4='
WHERE
key_id = '9e596c2b5fc198b742a74b59203bb05980f862a90c528bbabdb3dee3e4c73f09'
AND (
token = 'agY5wppnh4O3GsRtpZ/j7yi/vGHcy+3nYfNtzE0m+j4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)