UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b4Q3qPs6a9LEworAHeVwVJ0rdhBMRR58mw37+lLZGlk='
WHERE
key_id = '17191607389ddd4b5467e169b64a7e68d3f440021f22bc1c45a256d8c02c934c'
AND (
token = 'b4Q3qPs6a9LEworAHeVwVJ0rdhBMRR58mw37+lLZGlk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)