UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M0y4Z09rEaoEVI0kRq2IGRqSCmT4NDG7A1lr+r5BUnk='
WHERE
key_id = '731845f868fb1c7c34a3e8f6b2a2e49f09630c2571c6cd6364c4fd605863b1c3'
AND (
token = 'M0y4Z09rEaoEVI0kRq2IGRqSCmT4NDG7A1lr+r5BUnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)