UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '20uDzoJlI/TpU8leebnY/mi/qw4bC4f4gacKdZ+Z1Ow='
WHERE
key_id = 'e57a0af6ba5ea5cb9d8b50fe8b11a9fdfaeac3459f89df84843701a64340ca48'
AND (
token = '20uDzoJlI/TpU8leebnY/mi/qw4bC4f4gacKdZ+Z1Ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)