UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZSMCsz2W2juTHwmNnAOKkGzeyjGcsqA4JYw5qeXwRKs='
WHERE
key_id = 'e3b8a0f604a70b73e750c94059e0bc92b525fab5712daafc8b8093c7ca4514ec'
AND (
token = 'ZSMCsz2W2juTHwmNnAOKkGzeyjGcsqA4JYw5qeXwRKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)