UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avHenJlVCsIBttbcPPpOwaX9zIhZXSU3VihkT/kOQKc='
WHERE
key_id = 'caf25d31baaa230c2c09676f7bdefd8100264ee75922f72a86b2a366762dbc41'
AND (
token = 'avHenJlVCsIBttbcPPpOwaX9zIhZXSU3VihkT/kOQKc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)