UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Am83WHGBFDsTIerVQc3/9mwMhCnNzMj4B55f38qTom8='
WHERE
key_id = 'e556b6b811f8f9fe8c57aa0f7c4675627347ecb532c2fa89393c0865a6a4286e'
AND (
token = 'Am83WHGBFDsTIerVQc3/9mwMhCnNzMj4B55f38qTom8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)