UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SkZU7TMR+9mBOYYB9Y3Ua7UOvs8NN/9clFbE+/X4j50='
WHERE
key_id = '51383c5f0838987922bd35b68c221f0d8c04b4b611e3c800effdd24cbe814647'
AND (
token = 'SkZU7TMR+9mBOYYB9Y3Ua7UOvs8NN/9clFbE+/X4j50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)