UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yrIWn8prgkHERr4G99eWIHyy9/T7IYz1RNr2qR9VnMs='
WHERE
key_id = '0cd4a7801de8fa90fedc4f7e437c15a2c638e6f15fe88b080b3add25a560b677'
AND (
token = 'yrIWn8prgkHERr4G99eWIHyy9/T7IYz1RNr2qR9VnMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)