UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZHS8tJF5vliykZrnrZlyoJoZ+rX2/SHLIxfezpmE3cc='
WHERE
key_id = 'ff9abd54e727bc4c595fd7d6316eaf9467fa931e9014e5a78956166dcbd542d5'
AND (
token = 'ZHS8tJF5vliykZrnrZlyoJoZ+rX2/SHLIxfezpmE3cc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)