UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6S0ZQaTcRkV3hhVCkSNbeQk6Wus7kkc9hx3TfUciaEo='
WHERE
key_id = 'aef139c7e0f3b81dcee7a6dcd142c802f28267cfcb657544c18d59541d3d4bef'
AND (
token = '6S0ZQaTcRkV3hhVCkSNbeQk6Wus7kkc9hx3TfUciaEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)