UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QH0ZGxZi5W2RquYFiN4VYzbFZBnniQqm8L/eVPO+cJA=' 
WHERE 
  key_id = '4c91bec9c8ff51063898888d7d2ad666ccaf160eaf7460b4e9063d7e4e82d66e' 
  AND (
    token = 'QH0ZGxZi5W2RquYFiN4VYzbFZBnniQqm8L/eVPO+cJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037