UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7MMP3QaauEteB2NrYWfAna1InG+GkooAaRJbqqyXJbs=' 
WHERE 
  key_id = '397db111b0543804e08c320588552f732899e5166d524f0452570cb9b037f5ac' 
  AND (
    token = '7MMP3QaauEteB2NrYWfAna1InG+GkooAaRJbqqyXJbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035