UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BSDQCN79FDM/n+p/i4rMWBkGgi5NrLh7uhVaozvh3oY='
WHERE
key_id = 'b22ab0a822bd37f6716d6ebd9672bf9dc800a7eea58498d577e7c74838fca799'
AND (
token = 'BSDQCN79FDM/n+p/i4rMWBkGgi5NrLh7uhVaozvh3oY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)