UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I34hBpqpjYoJCtmtfUNoFcHM3vqtKIfdHXY3oIN83hs=' 
WHERE 
  key_id = '23285f3363778281e36035e97542a27fb9843c96e7781da75114c75104cc29ee' 
  AND (
    token = 'I34hBpqpjYoJCtmtfUNoFcHM3vqtKIfdHXY3oIN83hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037