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