UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TRXpjYcMEQA3ghKj4HFttpNCDPl2UaR+gDuDqgzh1dg=' 
WHERE 
  key_id = '0715892a0b02225388f1f3f3625e342e82184254812b70e93fae66a22a98472f' 
  AND (
    token = 'TRXpjYcMEQA3ghKj4HFttpNCDPl2UaR+gDuDqgzh1dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054