UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBqjS2V+e87gd4Hp8pBFRuBfbBnNcrrGgDn24fNwebc='
WHERE
key_id = '48ac04d35f35863c7a5fb0105a40cac158a54984ce1d7dc610612e83a89c2e1a'
AND (
token = 'BBqjS2V+e87gd4Hp8pBFRuBfbBnNcrrGgDn24fNwebc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)