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