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