UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HphMHJ51XPobaMVAe4FPTkZIToLlTAErPX2b0oXA7MM='
WHERE
key_id = '97ca3dfc622c2a7ff92ebf233639343114d7ce56666ae3afa4f46842632060e3'
AND (
token = 'HphMHJ51XPobaMVAe4FPTkZIToLlTAErPX2b0oXA7MM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)